package ueg.org.trabalho.view;

import javax.swing.JFrame;

public class GUIPrincipal extends javax.swing.JFrame {

    public GUIPrincipal() {
        initComponents();
        setExtendedState(JFrame.MAXIMIZED_BOTH);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktopPane = new javax.swing.JDesktopPane();
        menuBar = new javax.swing.JMenuBar();
        Cadastro = new javax.swing.JMenu();
        Empresa = new javax.swing.JMenuItem();
        Departamento = new javax.swing.JMenuItem();
        Funcionario = new javax.swing.JMenuItem();
        Sair = new javax.swing.JMenuItem();
        Consulta = new javax.swing.JMenu();
        ConsultaEmpresa = new javax.swing.JMenuItem();
        ConsultaDepartamento = new javax.swing.JMenuItem();
        ConsultaFuncionario = new javax.swing.JMenuItem();
        Help = new javax.swing.JMenu();
        Sobre = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        Cadastro.setMnemonic('f');
        Cadastro.setText("Cadastro");

        Empresa.setText("Empresa");
        Empresa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EmpresaActionPerformed(evt);
            }
        });
        Cadastro.add(Empresa);

        Departamento.setText("Departamento");
        Departamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DepartamentoActionPerformed(evt);
            }
        });
        Cadastro.add(Departamento);

        Funcionario.setText("Funcionario");
        Funcionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                FuncionarioActionPerformed(evt);
            }
        });
        Cadastro.add(Funcionario);

        Sair.setText("Exit");
        Sair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SairActionPerformed(evt);
            }
        });
        Cadastro.add(Sair);

        menuBar.add(Cadastro);

        Consulta.setMnemonic('e');
        Consulta.setText("Consulta");

        ConsultaEmpresa.setText("Empresa");
        ConsultaEmpresa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConsultaEmpresaActionPerformed(evt);
            }
        });
        Consulta.add(ConsultaEmpresa);

        ConsultaDepartamento.setText("Departamento");
        ConsultaDepartamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConsultaDepartamentoActionPerformed(evt);
            }
        });
        Consulta.add(ConsultaDepartamento);

        ConsultaFuncionario.setText("Funcionario");
        ConsultaFuncionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConsultaFuncionarioActionPerformed(evt);
            }
        });
        Consulta.add(ConsultaFuncionario);

        menuBar.add(Consulta);

        Help.setText("Help");

        Sobre.setText("Sobre");
        Sobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SobreActionPerformed(evt);
            }
        });
        Help.add(Sobre);

        menuBar.add(Help);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void SairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SairActionPerformed
        System.exit(0);
    }//GEN-LAST:event_SairActionPerformed

    private void FuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FuncionarioActionPerformed
        GUICadastroFuncionario guiCadastro = new GUICadastroFuncionario();
        if (guiCadastro == null) {
            guiCadastro = new GUICadastroFuncionario();
        }
        if (!guiCadastro.isVisible()) {
            desktopPane.add(guiCadastro);
            guiCadastro.setPosicao();
            guiCadastro.setVisible(true);
        }
    }//GEN-LAST:event_FuncionarioActionPerformed

    private void EmpresaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EmpresaActionPerformed
        GUICadastroEmpresa guiCadastro = new GUICadastroEmpresa();
        if (guiCadastro == null) {
            guiCadastro = new GUICadastroEmpresa();
        }
        if (!guiCadastro.isVisible()) {
            desktopPane.add(guiCadastro);
            guiCadastro.setPosicao();
            guiCadastro.setVisible(true);
        }
    }//GEN-LAST:event_EmpresaActionPerformed

    private void DepartamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DepartamentoActionPerformed
        GUICadastroDepartamento guiCadastro = new GUICadastroDepartamento();
        if (guiCadastro == null) {
            guiCadastro = new GUICadastroDepartamento();
        }
        if (!guiCadastro.isVisible()) {
            desktopPane.add(guiCadastro);
            guiCadastro.setPosicao();
            guiCadastro.setVisible(true);
        }
    }//GEN-LAST:event_DepartamentoActionPerformed

    private void SobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SobreActionPerformed
        GUISobre guiSobre = new GUISobre();
        if (guiSobre == null) {
            guiSobre = new GUISobre();
        }
        if (!guiSobre.isVisible()) {
            desktopPane.add(guiSobre);
            guiSobre.setPosicao();
            guiSobre.setVisible(true);
        }
    }//GEN-LAST:event_SobreActionPerformed

    private void ConsultaEmpresaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultaEmpresaActionPerformed
        GUIConsultaEmpresa guiConsulta = new GUIConsultaEmpresa();
        if (guiConsulta == null) {
            guiConsulta = new GUIConsultaEmpresa();
        }
        if (!guiConsulta.isVisible()) {
            desktopPane.add(guiConsulta);
            guiConsulta.setPosicao();
            guiConsulta.setVisible(true);
        }
    }//GEN-LAST:event_ConsultaEmpresaActionPerformed

    private void ConsultaDepartamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultaDepartamentoActionPerformed
        GUIConsultaDepartamento guiConsulta = new GUIConsultaDepartamento();
        if (guiConsulta == null) {
            guiConsulta = new GUIConsultaDepartamento();
        }
        if (!guiConsulta.isVisible()) {
            desktopPane.add(guiConsulta);
            guiConsulta.setPosicao();
            guiConsulta.setVisible(true);
        }
    }//GEN-LAST:event_ConsultaDepartamentoActionPerformed

    private void ConsultaFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultaFuncionarioActionPerformed
        GUIConsultaFuncionario guiConsulta = new GUIConsultaFuncionario();
        if (guiConsulta == null) {
            guiConsulta = new GUIConsultaFuncionario();
        }
        if (!guiConsulta.isVisible()) {
            desktopPane.add(guiConsulta);
            guiConsulta.setPosicao();
            guiConsulta.setVisible(true);
        }
    }//GEN-LAST:event_ConsultaFuncionarioActionPerformed

    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(GUIPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>


        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GUIPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu Cadastro;
    private javax.swing.JMenu Consulta;
    private javax.swing.JMenuItem ConsultaDepartamento;
    private javax.swing.JMenuItem ConsultaEmpresa;
    private javax.swing.JMenuItem ConsultaFuncionario;
    private javax.swing.JMenuItem Departamento;
    private javax.swing.JMenuItem Empresa;
    private javax.swing.JMenuItem Funcionario;
    private javax.swing.JMenu Help;
    private javax.swing.JMenuItem Sair;
    private javax.swing.JMenuItem Sobre;
    private javax.swing.JDesktopPane desktopPane;
    private javax.swing.JMenuBar menuBar;
    // End of variables declaration//GEN-END:variables
}
